import { createRouter, createWebHistory } from 'vue-router'
import Router from "@/router/index.js";
//创建路由对象
const router = createRouter({
    history: createWebHistory(import.meta.env.BASE_URL),
    routes: [
        {
            path: '/',
            name: 'Layout',
            component:()=>import('../views/Layout.vue'),
            redirect:'/home',
            children:[{
                path:'/home',
                name:'home',
                component:()=>import('../views/Home/Home.vue')
            },
                {
                    path: '/Goods',
                    name: 'Goods',
                    component: () => import('../components/Goods.vue'),
                    props: true,
                },
                {
                    path: '/cart',
                    name: 'cart',
                    component: () => import('../components/cart.vue')
                },
                {
                    path: '/collect',
                    name: 'collect',
                    component: () => import('../components/favorites.vue')
                }
            ]
        },{
        path:'/Login',
        name:'login',
        component:()=>import('../views/Login.vue')
        }
    ]
})

export default router
